package meterMonitor.service;

import meterMonitor.mapper.SlotMapper;
import meterMonitor.model.SlotPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SlotService {

    @Autowired
    private SlotMapper slotMapper;

    public void addSlot(SlotPO slot) {
        slotMapper.addSlot(slot);
    }

    public void updateSlot(SlotPO slot) {
        slotMapper.updateSlot(slot);
    }


    public void deleteSlot(Integer slotId) {
        slotMapper.deleteSlotById(slotId);
    }

    public SlotPO getSlotById(Integer slotId) {
        return slotMapper.getSlotById(slotId);
    }

    public List<SlotPO> querySlotByLineId(Integer lineId) {
        SlotPO slot = new SlotPO();
        slot.setLineId(lineId);
        return querySlot(slot);
    }

    public List<SlotPO> querySlot(SlotPO slot) {
        return slotMapper.querySlot(slot);
    }


}
